import type { PageLoad } from './$types';
import * as commands from '$lib/commands'

import type { IpcResponse, Klt, ListParams, Security, SecurityFilter } from '$lib/bindings';
import type { CorrelationMatrix } from '$lib/bindings/CorrelationMatrix';
import { KLINE_INIT_SIZE, convertToKlt } from '$lib';


export const load: PageLoad = async ({ url, route, params }) => {
    let { id, klt, size } = params;
    console.log("route=", route, " url=", url, " params=", params);

    if (size === undefined || size === null || size === "") {
        size = String(KLINE_INIT_SIZE);
    }

    return {
        security_id: id, klt: convertToKlt(klt), size: Number(size), open: {
            M005: false,
            M015: false,
            M030: false,
            M060: false,
            DAY: true,
            WEEK: false,
            MONTH: false,
        }
    }

};